import request from '@/utils/request'

// 定义多个方法
const apiMethods = {
  path: '/package',
  getList(params) {
    return request({
      url: this.path + '/list',
      method: 'get',
      params
    })
  },
  info(id) {
    return request({
      url: this.path + `/${id}`,
      method: 'get'
    })
  },
  state(id) {
    return request({
      url: this.path + `/state/${id}`,
      method: 'put'
    })
  },
  add(data) {
    return request({
      url: this.path + '/add',
      method: 'post',
      data
    })
  },
  update(data) {
    return request({
      url: this.path + `/${data.id}`,
      method: 'put',
      data
    })
  },
  delete(id) {
    return request({
      url: this.path + `/${id}`,
      method: 'delete'
    })
  },
  push_update(data) {
    return request({
      url: this.path + `/push_update`,
      method: 'post',
      data
    })
  }
}

export default apiMethods
